<?php
// +----------------------------------------------------------------------
// | KITEGO-Admin「开箱即用」「人人全栈」
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2024 https://www.kitego.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed KITEGO并不是自由软件，未经许可不能去掉KITEGO相关版权
// +----------------------------------------------------------------------
// | Author: KITEGO Team <bd@kitego.cn>
// +----------------------------------------------------------------------

namespace kitego\traits;

trait AdminAuthTrait
{
    /**
     * 返回管理员所有接口以及无需鉴权接口
     */
    public static function getAdminAuthList(): array
    {
        // 获取所有接口
        $allAuthListQuery = event('UpdateAdminAuth')[0];

        // 所有无需鉴权接口
        $allWithoutAuth = [];
        foreach ($allAuthListQuery as &$v) {
            $v['auth'] = trim($v['auth']);
            if ($v['is_verify'] == 0) {
                $allWithoutAuth[$v['method']][] = $v['auth'];
            }
        }

        return [$allAuthListQuery, $allWithoutAuth];
    }
}
